//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2024 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
@_spi(SotoInternal) import SotoCore

extension RedshiftData {
    // MARK: Enums

    public enum ResultFormatString: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case csv = "CSV"
        case json = "JSON"
        public var description: String { return self.rawValue }
    }

    public enum StatementStatusString: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case aborted = "ABORTED"
        case failed = "FAILED"
        case finished = "FINISHED"
        case picked = "PICKED"
        case started = "STARTED"
        case submitted = "SUBMITTED"
        public var description: String { return self.rawValue }
    }

    public enum StatusString: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case aborted = "ABORTED"
        case all = "ALL"
        case failed = "FAILED"
        case finished = "FINISHED"
        case picked = "PICKED"
        case started = "STARTED"
        case submitted = "SUBMITTED"
        public var description: String { return self.rawValue }
    }

    public enum Field: AWSDecodableShape, Sendable {
        /// A value of the BLOB data type.
        case blobValue(AWSBase64Data)
        /// A value of the Boolean data type.
        case booleanValue(Bool)
        /// A value of the double data type.
        case doubleValue(Double)
        /// A value that indicates whether the data is NULL.
        case isNull(Bool)
        /// A value of the long data type.
        case longValue(Int64)
        /// A value of the string data type.
        case stringValue(String)

        public init(from decoder: Decoder) throws {
            let container = try decoder.container(keyedBy: CodingKeys.self)
            guard container.allKeys.count == 1, let key = container.allKeys.first else {
                let context = DecodingError.Context(
                    codingPath: container.codingPath,
                    debugDescription: "Expected exactly one key, but got \(container.allKeys.count)"
                )
                throw DecodingError.dataCorrupted(context)
            }
            switch key {
            case .blobValue:
                let value = try container.decode(AWSBase64Data.self, forKey: .blobValue)
                self = .blobValue(value)
            case .booleanValue:
                let value = try container.decode(Bool.self, forKey: .booleanValue)
                self = .booleanValue(value)
            case .doubleValue:
                let value = try container.decode(Double.self, forKey: .doubleValue)
                self = .doubleValue(value)
            case .isNull:
                let value = try container.decode(Bool.self, forKey: .isNull)
                self = .isNull(value)
            case .longValue:
                let value = try container.decode(Int64.self, forKey: .longValue)
                self = .longValue(value)
            case .stringValue:
                let value = try container.decode(String.self, forKey: .stringValue)
                self = .stringValue(value)
            }
        }

        private enum CodingKeys: String, CodingKey {
            case blobValue = "blobValue"
            case booleanValue = "booleanValue"
            case doubleValue = "doubleValue"
            case isNull = "isNull"
            case longValue = "longValue"
            case stringValue = "stringValue"
        }
    }

    // MARK: Shapes

    public struct BatchExecuteStatementException: AWSErrorShape {
        public let message: String
        /// Statement identifier of the exception.
        public let statementId: String

        @inlinable
        public init(message: String, statementId: String) {
            self.message = message
            self.statementId = statementId
        }

        private enum CodingKeys: String, CodingKey {
            case message = "Message"
            case statementId = "StatementId"
        }
    }

    public struct BatchExecuteStatementInput: AWSEncodableShape {
        /// A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
        public let clientToken: String?
        /// The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
        public let clusterIdentifier: String?
        /// The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.
        public let database: String?
        /// The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.
        public let dbUser: String?
        /// The data format of the result of the SQL statement. If no format is specified, the default is JSON.
        public let resultFormat: ResultFormatString?
        /// The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.
        public let secretArn: String?
        /// The session identifier of the query.
        public let sessionId: String?
        /// The number of seconds to keep the session alive after the query finishes. The maximum time a session can keep alive is 24 hours. After 24 hours, the session is forced closed and the query is terminated.
        public let sessionKeepAliveSeconds: Int?
        /// One or more SQL statements to run.   The SQL statements are run as a single transaction. They run serially in the order of the array.  Subsequent SQL statements don't start until the previous statement in the array completes.  If any SQL statement fails, then because they are run as one transaction, all work is rolled back.
        public let sqls: [String]
        /// The name of the SQL statements. You can name the SQL statements when you create them to identify the query.
        public let statementName: String?
        /// A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statements run.
        public let withEvent: Bool?
        /// The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
        public let workgroupName: String?

        @inlinable
        public init(clientToken: String? = BatchExecuteStatementInput.idempotencyToken(), clusterIdentifier: String? = nil, database: String? = nil, dbUser: String? = nil, resultFormat: ResultFormatString? = nil, secretArn: String? = nil, sessionId: String? = nil, sessionKeepAliveSeconds: Int? = nil, sqls: [String], statementName: String? = nil, withEvent: Bool? = nil, workgroupName: String? = nil) {
            self.clientToken = clientToken
            self.clusterIdentifier = clusterIdentifier
            self.database = database
            self.dbUser = dbUser
            self.resultFormat = resultFormat
            self.secretArn = secretArn
            self.sessionId = sessionId
            self.sessionKeepAliveSeconds = sessionKeepAliveSeconds
            self.sqls = sqls
            self.statementName = statementName
            self.withEvent = withEvent
            self.workgroupName = workgroupName
        }

        public func validate(name: String) throws {
            try self.validate(self.clientToken, name: "clientToken", parent: name, max: 64)
            try self.validate(self.clientToken, name: "clientToken", parent: name, min: 1)
            try self.validate(self.clusterIdentifier, name: "clusterIdentifier", parent: name, max: 63)
            try self.validate(self.clusterIdentifier, name: "clusterIdentifier", parent: name, min: 1)
            try self.validate(self.sessionId, name: "sessionId", parent: name, pattern: "^[a-z0-9]{8}(-[a-z0-9]{4}){3}-[a-z0-9]{12}(:\\d+)?$")
            try self.validate(self.sessionKeepAliveSeconds, name: "sessionKeepAliveSeconds", parent: name, max: 86400)
            try self.validate(self.sessionKeepAliveSeconds, name: "sessionKeepAliveSeconds", parent: name, min: 0)
            try self.validate(self.sqls, name: "sqls", parent: name, max: 40)
            try self.validate(self.sqls, name: "sqls", parent: name, min: 1)
            try self.validate(self.statementName, name: "statementName", parent: name, max: 500)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, max: 128)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, min: 3)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, pattern: "^(([a-z0-9-]+)|(arn:(aws(-[a-z]+)*):redshift-serverless:[a-z]{2}(-gov|(-iso[a-z]?))?-[a-z]+-\\d{1}:\\d{12}:workgroup/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}))$")
        }

        private enum CodingKeys: String, CodingKey {
            case clientToken = "ClientToken"
            case clusterIdentifier = "ClusterIdentifier"
            case database = "Database"
            case dbUser = "DbUser"
            case resultFormat = "ResultFormat"
            case secretArn = "SecretArn"
            case sessionId = "SessionId"
            case sessionKeepAliveSeconds = "SessionKeepAliveSeconds"
            case sqls = "Sqls"
            case statementName = "StatementName"
            case withEvent = "WithEvent"
            case workgroupName = "WorkgroupName"
        }
    }

    public struct BatchExecuteStatementOutput: AWSDecodableShape {
        /// The cluster identifier. This element is not returned when connecting to a serverless workgroup.
        public let clusterIdentifier: String?
        /// The date and time (UTC) the statement was created.
        public let createdAt: Date?
        /// The name of the database.
        public let database: String?
        /// A list of colon (:) separated names of database groups.
        public let dbGroups: [String]?
        /// The database user name.
        public let dbUser: String?
        /// The identifier of the SQL statement whose results are to be fetched. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API.  This identifier is returned by BatchExecuteStatment.
        public let id: String?
        /// The name or ARN of the secret that enables access to the database.
        public let secretArn: String?
        /// The session identifier of the query.
        public let sessionId: String?
        /// The serverless workgroup name or Amazon Resource Name (ARN). This element is not returned when connecting to a provisioned cluster.
        public let workgroupName: String?

        @inlinable
        public init(clusterIdentifier: String? = nil, createdAt: Date? = nil, database: String? = nil, dbGroups: [String]? = nil, dbUser: String? = nil, id: String? = nil, secretArn: String? = nil, sessionId: String? = nil, workgroupName: String? = nil) {
            self.clusterIdentifier = clusterIdentifier
            self.createdAt = createdAt
            self.database = database
            self.dbGroups = dbGroups
            self.dbUser = dbUser
            self.id = id
            self.secretArn = secretArn
            self.sessionId = sessionId
            self.workgroupName = workgroupName
        }

        private enum CodingKeys: String, CodingKey {
            case clusterIdentifier = "ClusterIdentifier"
            case createdAt = "CreatedAt"
            case database = "Database"
            case dbGroups = "DbGroups"
            case dbUser = "DbUser"
            case id = "Id"
            case secretArn = "SecretArn"
            case sessionId = "SessionId"
            case workgroupName = "WorkgroupName"
        }
    }

    public struct CancelStatementRequest: AWSEncodableShape {
        /// The identifier of the SQL statement to cancel. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API.  This identifier is returned by BatchExecuteStatment, ExecuteStatment, and ListStatements.
        public let id: String

        @inlinable
        public init(id: String) {
            self.id = id
        }

        public func validate(name: String) throws {
            try self.validate(self.id, name: "id", parent: name, pattern: "^[a-z0-9]{8}(-[a-z0-9]{4}){3}-[a-z0-9]{12}(:\\d+)?$")
        }

        private enum CodingKeys: String, CodingKey {
            case id = "Id"
        }
    }

    public struct CancelStatementResponse: AWSDecodableShape {
        /// A value that indicates whether the cancel statement succeeded (true).
        public let status: Bool?

        @inlinable
        public init(status: Bool? = nil) {
            self.status = status
        }

        private enum CodingKeys: String, CodingKey {
            case status = "Status"
        }
    }

    public struct ColumnMetadata: AWSDecodableShape {
        /// The default value of the column.
        public let columnDefault: String?
        /// A value that indicates whether the column is case-sensitive.
        public let isCaseSensitive: Bool?
        /// A value that indicates whether the column contains currency values.
        public let isCurrency: Bool?
        /// A value that indicates whether an integer column is signed.
        public let isSigned: Bool?
        /// The label for the column.
        public let label: String?
        /// The length of the column.
        public let length: Int?
        /// The name of the column.
        public let name: String?
        /// A value that indicates whether the column is nullable.
        public let nullable: Int?
        /// The precision value of a decimal number column.
        public let precision: Int?
        /// The scale value of a decimal number column.
        public let scale: Int?
        /// The name of the schema that contains the table that includes the column.
        public let schemaName: String?
        /// The name of the table that includes the column.
        public let tableName: String?
        /// The database-specific data type of the column.
        public let typeName: String?

        @inlinable
        public init(columnDefault: String? = nil, isCaseSensitive: Bool? = nil, isCurrency: Bool? = nil, isSigned: Bool? = nil, label: String? = nil, length: Int? = nil, name: String? = nil, nullable: Int? = nil, precision: Int? = nil, scale: Int? = nil, schemaName: String? = nil, tableName: String? = nil, typeName: String? = nil) {
            self.columnDefault = columnDefault
            self.isCaseSensitive = isCaseSensitive
            self.isCurrency = isCurrency
            self.isSigned = isSigned
            self.label = label
            self.length = length
            self.name = name
            self.nullable = nullable
            self.precision = precision
            self.scale = scale
            self.schemaName = schemaName
            self.tableName = tableName
            self.typeName = typeName
        }

        private enum CodingKeys: String, CodingKey {
            case columnDefault = "columnDefault"
            case isCaseSensitive = "isCaseSensitive"
            case isCurrency = "isCurrency"
            case isSigned = "isSigned"
            case label = "label"
            case length = "length"
            case name = "name"
            case nullable = "nullable"
            case precision = "precision"
            case scale = "scale"
            case schemaName = "schemaName"
            case tableName = "tableName"
            case typeName = "typeName"
        }
    }

    public struct DescribeStatementRequest: AWSEncodableShape {
        /// The identifier of the SQL statement to describe. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API.  A suffix indicates the number of the SQL statement. For example, d9b6c0c9-0747-4bf4-b142-e8883122f766:2 has a suffix of :2 that indicates the second SQL statement of a batch query. This identifier is returned by BatchExecuteStatment, ExecuteStatement, and ListStatements.
        public let id: String

        @inlinable
        public init(id: String) {
            self.id = id
        }

        public func validate(name: String) throws {
            try self.validate(self.id, name: "id", parent: name, pattern: "^[a-z0-9]{8}(-[a-z0-9]{4}){3}-[a-z0-9]{12}(:\\d+)?$")
        }

        private enum CodingKeys: String, CodingKey {
            case id = "Id"
        }
    }

    public struct DescribeStatementResponse: AWSDecodableShape {
        /// The cluster identifier.
        public let clusterIdentifier: String?
        /// The date and time (UTC) when the SQL statement was submitted to run.
        public let createdAt: Date?
        /// The name of the database.
        public let database: String?
        /// The database user name.
        public let dbUser: String?
        /// The amount of time in nanoseconds that the statement ran.
        public let duration: Int64?
        /// The error message from the cluster if the SQL statement encountered an error while running.
        public let error: String?
        /// A value that indicates whether the statement has a result set. The result set can be empty. The value is true for an empty result set. The value is true if any substatement returns a result set.
        public let hasResultSet: Bool?
        /// The identifier of the SQL statement described. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API.
        public let id: String
        /// The parameters for the SQL statement.
        public let queryParameters: [SqlParameter]?
        /// The SQL statement text.
        public let queryString: String?
        /// The process identifier from Amazon Redshift.
        public let redshiftPid: Int64?
        /// The identifier of the query generated by Amazon Redshift.  These identifiers are also available in the query column of the STL_QUERY system view.
        public let redshiftQueryId: Int64?
        /// The data format of the result of the SQL statement.
        public let resultFormat: ResultFormatString?
        /// Either the number of rows returned from the SQL statement or the number of rows affected. If result size is greater than zero, the result rows can be the number of rows affected by SQL statements such as INSERT, UPDATE, DELETE, COPY, and others.  A -1 indicates the value is null.
        public let resultRows: Int64?
        /// The size in bytes of the returned results. A -1 indicates the value is null.
        public let resultSize: Int64?
        /// The name or Amazon Resource Name (ARN) of the secret that enables access to the database.
        public let secretArn: String?
        /// The session identifier of the query.
        public let sessionId: String?
        /// The status of the SQL statement being described. Status values are defined as follows:    ABORTED - The query run was stopped by the user.    ALL -  A status value that includes all query statuses. This value can be used to filter results.    FAILED - The query run failed.    FINISHED - The query has finished running.    PICKED - The query has been chosen to be run.    STARTED - The query run has started.    SUBMITTED - The query was submitted, but not yet processed.
        public let status: StatusString?
        /// The SQL statements from a multiple statement run.
        public let subStatements: [SubStatementData]?
        /// The date and time (UTC) that the metadata for the SQL statement was last updated. An example is the time the status last changed.
        public let updatedAt: Date?
        /// The serverless workgroup name or Amazon Resource Name (ARN).
        public let workgroupName: String?

        @inlinable
        public init(clusterIdentifier: String? = nil, createdAt: Date? = nil, database: String? = nil, dbUser: String? = nil, duration: Int64? = nil, error: String? = nil, hasResultSet: Bool? = nil, id: String, queryParameters: [SqlParameter]? = nil, queryString: String? = nil, redshiftPid: Int64? = nil, redshiftQueryId: Int64? = nil, resultFormat: ResultFormatString? = nil, resultRows: Int64? = nil, resultSize: Int64? = nil, secretArn: String? = nil, sessionId: String? = nil, status: StatusString? = nil, subStatements: [SubStatementData]? = nil, updatedAt: Date? = nil, workgroupName: String? = nil) {
            self.clusterIdentifier = clusterIdentifier
            self.createdAt = createdAt
            self.database = database
            self.dbUser = dbUser
            self.duration = duration
            self.error = error
            self.hasResultSet = hasResultSet
            self.id = id
            self.queryParameters = queryParameters
            self.queryString = queryString
            self.redshiftPid = redshiftPid
            self.redshiftQueryId = redshiftQueryId
            self.resultFormat = resultFormat
            self.resultRows = resultRows
            self.resultSize = resultSize
            self.secretArn = secretArn
            self.sessionId = sessionId
            self.status = status
            self.subStatements = subStatements
            self.updatedAt = updatedAt
            self.workgroupName = workgroupName
        }

        private enum CodingKeys: String, CodingKey {
            case clusterIdentifier = "ClusterIdentifier"
            case createdAt = "CreatedAt"
            case database = "Database"
            case dbUser = "DbUser"
            case duration = "Duration"
            case error = "Error"
            case hasResultSet = "HasResultSet"
            case id = "Id"
            case queryParameters = "QueryParameters"
            case queryString = "QueryString"
            case redshiftPid = "RedshiftPid"
            case redshiftQueryId = "RedshiftQueryId"
            case resultFormat = "ResultFormat"
            case resultRows = "ResultRows"
            case resultSize = "ResultSize"
            case secretArn = "SecretArn"
            case sessionId = "SessionId"
            case status = "Status"
            case subStatements = "SubStatements"
            case updatedAt = "UpdatedAt"
            case workgroupName = "WorkgroupName"
        }
    }

    public struct DescribeTableRequest: AWSEncodableShape {
        /// The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
        public let clusterIdentifier: String?
        /// A database name. The connected database is specified when you connect with your authentication credentials.
        public let connectedDatabase: String?
        /// The name of the database that contains the tables to be described.   If ConnectedDatabase is not specified, this is also the database to connect to with your authentication credentials.
        public let database: String
        /// The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.
        public let dbUser: String?
        /// The maximum number of tables to return in the response.  If more tables exist than fit in one response, then NextToken is returned to page through the results.
        public let maxResults: Int?
        /// A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.
        public let nextToken: String?
        /// The schema that contains the table. If no schema is specified, then matching tables for all schemas are returned.
        public let schema: String?
        /// The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.
        public let secretArn: String?
        /// The table name. If no table is specified, then all tables for all matching schemas are returned.  If no table and no schema is specified, then all tables for all schemas in the database are returned
        public let table: String?
        /// The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
        public let workgroupName: String?

        @inlinable
        public init(clusterIdentifier: String? = nil, connectedDatabase: String? = nil, database: String, dbUser: String? = nil, maxResults: Int? = nil, nextToken: String? = nil, schema: String? = nil, secretArn: String? = nil, table: String? = nil, workgroupName: String? = nil) {
            self.clusterIdentifier = clusterIdentifier
            self.connectedDatabase = connectedDatabase
            self.database = database
            self.dbUser = dbUser
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.schema = schema
            self.secretArn = secretArn
            self.table = table
            self.workgroupName = workgroupName
        }

        public func validate(name: String) throws {
            try self.validate(self.clusterIdentifier, name: "clusterIdentifier", parent: name, max: 63)
            try self.validate(self.clusterIdentifier, name: "clusterIdentifier", parent: name, min: 1)
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 1000)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 0)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, max: 128)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, min: 3)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, pattern: "^(([a-z0-9-]+)|(arn:(aws(-[a-z]+)*):redshift-serverless:[a-z]{2}(-gov|(-iso[a-z]?))?-[a-z]+-\\d{1}:\\d{12}:workgroup/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}))$")
        }

        private enum CodingKeys: String, CodingKey {
            case clusterIdentifier = "ClusterIdentifier"
            case connectedDatabase = "ConnectedDatabase"
            case database = "Database"
            case dbUser = "DbUser"
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
            case schema = "Schema"
            case secretArn = "SecretArn"
            case table = "Table"
            case workgroupName = "WorkgroupName"
        }
    }

    public struct DescribeTableResponse: AWSDecodableShape {
        /// A list of columns in the table.
        public let columnList: [ColumnMetadata]?
        /// A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.
        public let nextToken: String?
        /// The table name.
        public let tableName: String?

        @inlinable
        public init(columnList: [ColumnMetadata]? = nil, nextToken: String? = nil, tableName: String? = nil) {
            self.columnList = columnList
            self.nextToken = nextToken
            self.tableName = tableName
        }

        private enum CodingKeys: String, CodingKey {
            case columnList = "ColumnList"
            case nextToken = "NextToken"
            case tableName = "TableName"
        }
    }

    public struct ExecuteStatementException: AWSErrorShape {
        /// The exception message.
        public let message: String
        /// Statement identifier of the exception.
        public let statementId: String

        @inlinable
        public init(message: String, statementId: String) {
            self.message = message
            self.statementId = statementId
        }

        private enum CodingKeys: String, CodingKey {
            case message = "Message"
            case statementId = "StatementId"
        }
    }

    public struct ExecuteStatementInput: AWSEncodableShape {
        /// A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
        public let clientToken: String?
        /// The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
        public let clusterIdentifier: String?
        /// The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.
        public let database: String?
        /// The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.
        public let dbUser: String?
        /// The parameters for the SQL statement.
        public let parameters: [SqlParameter]?
        /// The data format of the result of the SQL statement. If no format is specified, the default is JSON.
        public let resultFormat: ResultFormatString?
        /// The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.
        public let secretArn: String?
        /// The session identifier of the query.
        public let sessionId: String?
        /// The number of seconds to keep the session alive after the query finishes. The maximum time a session can keep alive is 24 hours. After 24 hours, the session is forced closed and the query is terminated.
        public let sessionKeepAliveSeconds: Int?
        /// The SQL statement text to run.
        public let sql: String
        /// The name of the SQL statement. You can name the SQL statement when you create it to identify the query.
        public let statementName: String?
        /// A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.
        public let withEvent: Bool?
        /// The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
        public let workgroupName: String?

        @inlinable
        public init(clientToken: String? = ExecuteStatementInput.idempotencyToken(), clusterIdentifier: String? = nil, database: String? = nil, dbUser: String? = nil, parameters: [SqlParameter]? = nil, resultFormat: ResultFormatString? = nil, secretArn: String? = nil, sessionId: String? = nil, sessionKeepAliveSeconds: Int? = nil, sql: String, statementName: String? = nil, withEvent: Bool? = nil, workgroupName: String? = nil) {
            self.clientToken = clientToken
            self.clusterIdentifier = clusterIdentifier
            self.database = database
            self.dbUser = dbUser
            self.parameters = parameters
            self.resultFormat = resultFormat
            self.secretArn = secretArn
            self.sessionId = sessionId
            self.sessionKeepAliveSeconds = sessionKeepAliveSeconds
            self.sql = sql
            self.statementName = statementName
            self.withEvent = withEvent
            self.workgroupName = workgroupName
        }

        public func validate(name: String) throws {
            try self.validate(self.clientToken, name: "clientToken", parent: name, max: 64)
            try self.validate(self.clientToken, name: "clientToken", parent: name, min: 1)
            try self.validate(self.clusterIdentifier, name: "clusterIdentifier", parent: name, max: 63)
            try self.validate(self.clusterIdentifier, name: "clusterIdentifier", parent: name, min: 1)
            try self.parameters?.forEach {
                try $0.validate(name: "\(name).parameters[]")
            }
            try self.validate(self.parameters, name: "parameters", parent: name, min: 1)
            try self.validate(self.sessionId, name: "sessionId", parent: name, pattern: "^[a-z0-9]{8}(-[a-z0-9]{4}){3}-[a-z0-9]{12}(:\\d+)?$")
            try self.validate(self.sessionKeepAliveSeconds, name: "sessionKeepAliveSeconds", parent: name, max: 86400)
            try self.validate(self.sessionKeepAliveSeconds, name: "sessionKeepAliveSeconds", parent: name, min: 0)
            try self.validate(self.statementName, name: "statementName", parent: name, max: 500)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, max: 128)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, min: 3)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, pattern: "^(([a-z0-9-]+)|(arn:(aws(-[a-z]+)*):redshift-serverless:[a-z]{2}(-gov|(-iso[a-z]?))?-[a-z]+-\\d{1}:\\d{12}:workgroup/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}))$")
        }

        private enum CodingKeys: String, CodingKey {
            case clientToken = "ClientToken"
            case clusterIdentifier = "ClusterIdentifier"
            case database = "Database"
            case dbUser = "DbUser"
            case parameters = "Parameters"
            case resultFormat = "ResultFormat"
            case secretArn = "SecretArn"
            case sessionId = "SessionId"
            case sessionKeepAliveSeconds = "SessionKeepAliveSeconds"
            case sql = "Sql"
            case statementName = "StatementName"
            case withEvent = "WithEvent"
            case workgroupName = "WorkgroupName"
        }
    }

    public struct ExecuteStatementOutput: AWSDecodableShape {
        /// The cluster identifier. This element is not returned when connecting to a serverless workgroup.
        public let clusterIdentifier: String?
        /// The date and time (UTC) the statement was created.
        public let createdAt: Date?
        /// The name of the database.
        public let database: String?
        /// A list of colon (:) separated names of database groups.
        public let dbGroups: [String]?
        /// The database user name.
        public let dbUser: String?
        /// The identifier of the SQL statement whose results are to be fetched. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API.
        public let id: String?
        /// The name or ARN of the secret that enables access to the database.
        public let secretArn: String?
        /// The session identifier of the query.
        public let sessionId: String?
        /// The serverless workgroup name or Amazon Resource Name (ARN). This element is not returned when connecting to a provisioned cluster.
        public let workgroupName: String?

        @inlinable
        public init(clusterIdentifier: String? = nil, createdAt: Date? = nil, database: String? = nil, dbGroups: [String]? = nil, dbUser: String? = nil, id: String? = nil, secretArn: String? = nil, sessionId: String? = nil, workgroupName: String? = nil) {
            self.clusterIdentifier = clusterIdentifier
            self.createdAt = createdAt
            self.database = database
            self.dbGroups = dbGroups
            self.dbUser = dbUser
            self.id = id
            self.secretArn = secretArn
            self.sessionId = sessionId
            self.workgroupName = workgroupName
        }

        private enum CodingKeys: String, CodingKey {
            case clusterIdentifier = "ClusterIdentifier"
            case createdAt = "CreatedAt"
            case database = "Database"
            case dbGroups = "DbGroups"
            case dbUser = "DbUser"
            case id = "Id"
            case secretArn = "SecretArn"
            case sessionId = "SessionId"
            case workgroupName = "WorkgroupName"
        }
    }

    public struct GetStatementResultRequest: AWSEncodableShape {
        /// The identifier of the SQL statement whose results are to be fetched. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API.  A suffix indicates then number of the SQL statement. For example, d9b6c0c9-0747-4bf4-b142-e8883122f766:2 has a suffix of :2 that indicates the second SQL statement of a batch query. This identifier is returned by BatchExecuteStatment, ExecuteStatment, and ListStatements.
        public let id: String
        /// A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.
        public let nextToken: String?

        @inlinable
        public init(id: String, nextToken: String? = nil) {
            self.id = id
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try self.validate(self.id, name: "id", parent: name, pattern: "^[a-z0-9]{8}(-[a-z0-9]{4}){3}-[a-z0-9]{12}(:\\d+)?$")
        }

        private enum CodingKeys: String, CodingKey {
            case id = "Id"
            case nextToken = "NextToken"
        }
    }

    public struct GetStatementResultResponse: AWSDecodableShape {
        /// The properties (metadata) of a column.
        public let columnMetadata: [ColumnMetadata]?
        /// A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.
        public let nextToken: String?
        /// The results of the SQL statement in JSON format.
        public let records: [[Field]]
        /// The total number of rows in the result set returned from a query.  You can use this number to estimate the number of calls to the GetStatementResult operation needed to page through the results.
        public let totalNumRows: Int64?

        @inlinable
        public init(columnMetadata: [ColumnMetadata]? = nil, nextToken: String? = nil, records: [[Field]], totalNumRows: Int64? = nil) {
            self.columnMetadata = columnMetadata
            self.nextToken = nextToken
            self.records = records
            self.totalNumRows = totalNumRows
        }

        private enum CodingKeys: String, CodingKey {
            case columnMetadata = "ColumnMetadata"
            case nextToken = "NextToken"
            case records = "Records"
            case totalNumRows = "TotalNumRows"
        }
    }

    public struct GetStatementResultV2Request: AWSEncodableShape {
        /// The identifier of the SQL statement whose results are to be fetched. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API.  A suffix indicates then number of the SQL statement. For example, d9b6c0c9-0747-4bf4-b142-e8883122f766:2 has a suffix of :2 that indicates the second SQL statement of a batch query. This identifier is returned by BatchExecuteStatment, ExecuteStatment, and ListStatements.
        public let id: String
        /// A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.
        public let nextToken: String?

        @inlinable
        public init(id: String, nextToken: String? = nil) {
            self.id = id
            self.nextToken = nextToken
        }

        public func validate(name: String) throws {
            try self.validate(self.id, name: "id", parent: name, pattern: "^[a-z0-9]{8}(-[a-z0-9]{4}){3}-[a-z0-9]{12}(:\\d+)?$")
        }

        private enum CodingKeys: String, CodingKey {
            case id = "Id"
            case nextToken = "NextToken"
        }
    }

    public struct GetStatementResultV2Response: AWSDecodableShape {
        /// The properties (metadata) of a column.
        public let columnMetadata: [ColumnMetadata]?
        /// A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.
        public let nextToken: String?
        /// The results of the SQL statement in CSV format.
        public let records: [QueryRecords]
        /// The data format of the result of the SQL statement.
        public let resultFormat: ResultFormatString?
        /// The total number of rows in the result set returned from a query.  You can use this number to estimate the number of calls to the GetStatementResultV2 operation needed to page through the results.
        public let totalNumRows: Int64?

        @inlinable
        public init(columnMetadata: [ColumnMetadata]? = nil, nextToken: String? = nil, records: [QueryRecords], resultFormat: ResultFormatString? = nil, totalNumRows: Int64? = nil) {
            self.columnMetadata = columnMetadata
            self.nextToken = nextToken
            self.records = records
            self.resultFormat = resultFormat
            self.totalNumRows = totalNumRows
        }

        private enum CodingKeys: String, CodingKey {
            case columnMetadata = "ColumnMetadata"
            case nextToken = "NextToken"
            case records = "Records"
            case resultFormat = "ResultFormat"
            case totalNumRows = "TotalNumRows"
        }
    }

    public struct ListDatabasesRequest: AWSEncodableShape {
        /// The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
        public let clusterIdentifier: String?
        /// The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.
        public let database: String
        /// The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.
        public let dbUser: String?
        /// The maximum number of databases to return in the response.  If more databases exist than fit in one response, then NextToken is returned to page through the results.
        public let maxResults: Int?
        /// A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.
        public let nextToken: String?
        /// The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.
        public let secretArn: String?
        /// The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
        public let workgroupName: String?

        @inlinable
        public init(clusterIdentifier: String? = nil, database: String, dbUser: String? = nil, maxResults: Int? = nil, nextToken: String? = nil, secretArn: String? = nil, workgroupName: String? = nil) {
            self.clusterIdentifier = clusterIdentifier
            self.database = database
            self.dbUser = dbUser
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.secretArn = secretArn
            self.workgroupName = workgroupName
        }

        public func validate(name: String) throws {
            try self.validate(self.clusterIdentifier, name: "clusterIdentifier", parent: name, max: 63)
            try self.validate(self.clusterIdentifier, name: "clusterIdentifier", parent: name, min: 1)
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 1000)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 0)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, max: 128)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, min: 3)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, pattern: "^(([a-z0-9-]+)|(arn:(aws(-[a-z]+)*):redshift-serverless:[a-z]{2}(-gov|(-iso[a-z]?))?-[a-z]+-\\d{1}:\\d{12}:workgroup/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}))$")
        }

        private enum CodingKeys: String, CodingKey {
            case clusterIdentifier = "ClusterIdentifier"
            case database = "Database"
            case dbUser = "DbUser"
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
            case secretArn = "SecretArn"
            case workgroupName = "WorkgroupName"
        }
    }

    public struct ListDatabasesResponse: AWSDecodableShape {
        /// The names of databases.
        public let databases: [String]?
        /// A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.
        public let nextToken: String?

        @inlinable
        public init(databases: [String]? = nil, nextToken: String? = nil) {
            self.databases = databases
            self.nextToken = nextToken
        }

        private enum CodingKeys: String, CodingKey {
            case databases = "Databases"
            case nextToken = "NextToken"
        }
    }

    public struct ListSchemasRequest: AWSEncodableShape {
        /// The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
        public let clusterIdentifier: String?
        /// A database name. The connected database is specified when you connect with your authentication credentials.
        public let connectedDatabase: String?
        /// The name of the database that contains the schemas to list.  If ConnectedDatabase is not specified, this is also the database to connect to with your authentication credentials.
        public let database: String
        /// The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.
        public let dbUser: String?
        /// The maximum number of schemas to return in the response.  If more schemas exist than fit in one response, then NextToken is returned to page through the results.
        public let maxResults: Int?
        /// A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.
        public let nextToken: String?
        /// A pattern to filter results by schema name. Within a schema pattern, "%" means match any substring of 0 or more characters and "_" means match any one character. Only schema name entries matching the search pattern are returned.
        public let schemaPattern: String?
        /// The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.
        public let secretArn: String?
        /// The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
        public let workgroupName: String?

        @inlinable
        public init(clusterIdentifier: String? = nil, connectedDatabase: String? = nil, database: String, dbUser: String? = nil, maxResults: Int? = nil, nextToken: String? = nil, schemaPattern: String? = nil, secretArn: String? = nil, workgroupName: String? = nil) {
            self.clusterIdentifier = clusterIdentifier
            self.connectedDatabase = connectedDatabase
            self.database = database
            self.dbUser = dbUser
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.schemaPattern = schemaPattern
            self.secretArn = secretArn
            self.workgroupName = workgroupName
        }

        public func validate(name: String) throws {
            try self.validate(self.clusterIdentifier, name: "clusterIdentifier", parent: name, max: 63)
            try self.validate(self.clusterIdentifier, name: "clusterIdentifier", parent: name, min: 1)
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 1000)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 0)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, max: 128)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, min: 3)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, pattern: "^(([a-z0-9-]+)|(arn:(aws(-[a-z]+)*):redshift-serverless:[a-z]{2}(-gov|(-iso[a-z]?))?-[a-z]+-\\d{1}:\\d{12}:workgroup/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}))$")
        }

        private enum CodingKeys: String, CodingKey {
            case clusterIdentifier = "ClusterIdentifier"
            case connectedDatabase = "ConnectedDatabase"
            case database = "Database"
            case dbUser = "DbUser"
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
            case schemaPattern = "SchemaPattern"
            case secretArn = "SecretArn"
            case workgroupName = "WorkgroupName"
        }
    }

    public struct ListSchemasResponse: AWSDecodableShape {
        /// A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.
        public let nextToken: String?
        /// The schemas that match the request pattern.
        public let schemas: [String]?

        @inlinable
        public init(nextToken: String? = nil, schemas: [String]? = nil) {
            self.nextToken = nextToken
            self.schemas = schemas
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case schemas = "Schemas"
        }
    }

    public struct ListStatementsRequest: AWSEncodableShape {
        /// The cluster identifier. Only statements that ran on this cluster are returned.  When providing ClusterIdentifier, then WorkgroupName can't be specified.
        public let clusterIdentifier: String?
        /// The name of the database when listing statements run against a ClusterIdentifier or WorkgroupName.
        public let database: String?
        /// The maximum number of SQL statements to return in the response.  If more SQL statements exist than fit in one response, then NextToken is returned to page through the results.
        public let maxResults: Int?
        /// A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.
        public let nextToken: String?
        /// A value that filters which statements to return in the response. If true, all statements run by the caller's IAM role are returned.  If false, only statements run by the caller's IAM role in the current IAM session are returned.  The default is true.
        public let roleLevel: Bool?
        /// The name of the SQL statement specified as input to BatchExecuteStatement or ExecuteStatement to identify the query.  You can list multiple statements by providing a prefix that matches the beginning of the statement name.  For example, to list myStatement1, myStatement2, myStatement3, and so on, then provide the a value of myStatement.   Data API does a case-sensitive match of SQL statement names to the prefix value you provide.
        public let statementName: String?
        /// The status of the SQL statement to list. Status values are defined as follows:    ABORTED - The query run was stopped by the user.    ALL -  A status value that includes all query statuses. This value can be used to filter results.    FAILED - The query run failed.    FINISHED - The query has finished running.    PICKED - The query has been chosen to be run.    STARTED - The query run has started.    SUBMITTED - The query was submitted, but not yet processed.
        public let status: StatusString?
        /// The serverless workgroup name or Amazon Resource Name (ARN). Only statements that ran on this workgroup are returned.  When providing WorkgroupName, then ClusterIdentifier can't be specified.
        public let workgroupName: String?

        @inlinable
        public init(clusterIdentifier: String? = nil, database: String? = nil, maxResults: Int? = nil, nextToken: String? = nil, roleLevel: Bool? = nil, statementName: String? = nil, status: StatusString? = nil, workgroupName: String? = nil) {
            self.clusterIdentifier = clusterIdentifier
            self.database = database
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.roleLevel = roleLevel
            self.statementName = statementName
            self.status = status
            self.workgroupName = workgroupName
        }

        public func validate(name: String) throws {
            try self.validate(self.clusterIdentifier, name: "clusterIdentifier", parent: name, max: 63)
            try self.validate(self.clusterIdentifier, name: "clusterIdentifier", parent: name, min: 1)
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 100)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 0)
            try self.validate(self.statementName, name: "statementName", parent: name, max: 500)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, max: 128)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, min: 3)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, pattern: "^(([a-z0-9-]+)|(arn:(aws(-[a-z]+)*):redshift-serverless:[a-z]{2}(-gov|(-iso[a-z]?))?-[a-z]+-\\d{1}:\\d{12}:workgroup/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}))$")
        }

        private enum CodingKeys: String, CodingKey {
            case clusterIdentifier = "ClusterIdentifier"
            case database = "Database"
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
            case roleLevel = "RoleLevel"
            case statementName = "StatementName"
            case status = "Status"
            case workgroupName = "WorkgroupName"
        }
    }

    public struct ListStatementsResponse: AWSDecodableShape {
        /// A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.
        public let nextToken: String?
        /// The SQL statements.
        public let statements: [StatementData]

        @inlinable
        public init(nextToken: String? = nil, statements: [StatementData]) {
            self.nextToken = nextToken
            self.statements = statements
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case statements = "Statements"
        }
    }

    public struct ListTablesRequest: AWSEncodableShape {
        /// The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
        public let clusterIdentifier: String?
        /// A database name. The connected database is specified when you connect with your authentication credentials.
        public let connectedDatabase: String?
        /// The name of the database that contains the tables to list.  If ConnectedDatabase is not specified, this is also the database to connect to with your authentication credentials.
        public let database: String
        /// The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.
        public let dbUser: String?
        /// The maximum number of tables to return in the response.  If more tables exist than fit in one response, then NextToken is returned to page through the results.
        public let maxResults: Int?
        /// A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.
        public let nextToken: String?
        /// A pattern to filter results by schema name. Within a schema pattern, "%" means match any substring of 0 or more characters and "_" means match any one character. Only schema name entries matching the search pattern are returned. If SchemaPattern is not specified, then all tables that match  TablePattern are returned.  If neither SchemaPattern or TablePattern are specified, then all tables are returned.
        public let schemaPattern: String?
        /// The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.
        public let secretArn: String?
        /// A pattern to filter results by table name. Within a table pattern, "%" means match any substring of 0 or more characters and "_" means match any one character. Only table name entries matching the search pattern are returned. If TablePattern is not specified, then all tables that match  SchemaPatternare returned.   If neither SchemaPattern or TablePattern are specified, then all tables are returned.
        public let tablePattern: String?
        /// The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
        public let workgroupName: String?

        @inlinable
        public init(clusterIdentifier: String? = nil, connectedDatabase: String? = nil, database: String, dbUser: String? = nil, maxResults: Int? = nil, nextToken: String? = nil, schemaPattern: String? = nil, secretArn: String? = nil, tablePattern: String? = nil, workgroupName: String? = nil) {
            self.clusterIdentifier = clusterIdentifier
            self.connectedDatabase = connectedDatabase
            self.database = database
            self.dbUser = dbUser
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.schemaPattern = schemaPattern
            self.secretArn = secretArn
            self.tablePattern = tablePattern
            self.workgroupName = workgroupName
        }

        public func validate(name: String) throws {
            try self.validate(self.clusterIdentifier, name: "clusterIdentifier", parent: name, max: 63)
            try self.validate(self.clusterIdentifier, name: "clusterIdentifier", parent: name, min: 1)
            try self.validate(self.maxResults, name: "maxResults", parent: name, max: 1000)
            try self.validate(self.maxResults, name: "maxResults", parent: name, min: 0)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, max: 128)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, min: 3)
            try self.validate(self.workgroupName, name: "workgroupName", parent: name, pattern: "^(([a-z0-9-]+)|(arn:(aws(-[a-z]+)*):redshift-serverless:[a-z]{2}(-gov|(-iso[a-z]?))?-[a-z]+-\\d{1}:\\d{12}:workgroup/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}))$")
        }

        private enum CodingKeys: String, CodingKey {
            case clusterIdentifier = "ClusterIdentifier"
            case connectedDatabase = "ConnectedDatabase"
            case database = "Database"
            case dbUser = "DbUser"
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
            case schemaPattern = "SchemaPattern"
            case secretArn = "SecretArn"
            case tablePattern = "TablePattern"
            case workgroupName = "WorkgroupName"
        }
    }

    public struct ListTablesResponse: AWSDecodableShape {
        /// A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.
        public let nextToken: String?
        /// The tables that match the request pattern.
        public let tables: [TableMember]?

        @inlinable
        public init(nextToken: String? = nil, tables: [TableMember]? = nil) {
            self.nextToken = nextToken
            self.tables = tables
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case tables = "Tables"
        }
    }

    public struct ResourceNotFoundException: AWSErrorShape {
        /// The exception message.
        public let message: String
        /// Resource identifier associated with the exception.
        public let resourceId: String

        @inlinable
        public init(message: String, resourceId: String) {
            self.message = message
            self.resourceId = resourceId
        }

        private enum CodingKeys: String, CodingKey {
            case message = "Message"
            case resourceId = "ResourceId"
        }
    }

    public struct SqlParameter: AWSEncodableShape & AWSDecodableShape {
        /// The name of the parameter.
        public let name: String
        /// The value of the parameter.  Amazon Redshift implicitly converts to the proper data type. For more information, see  Data types in the  Amazon Redshift Database Developer Guide.
        public let value: String

        @inlinable
        public init(name: String, value: String) {
            self.name = name
            self.value = value
        }

        public func validate(name: String) throws {
            try self.validate(self.name, name: "name", parent: name, pattern: "^[0-9a-zA-Z_]+$")
            try self.validate(self.value, name: "value", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case name = "name"
            case value = "value"
        }
    }

    public struct StatementData: AWSDecodableShape {
        /// The date and time (UTC) the statement was created.
        public let createdAt: Date?
        /// The SQL statement identifier. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API.
        public let id: String
        /// A value that indicates whether the statement is a batch query request.
        public let isBatchStatement: Bool?
        /// The parameters used in a SQL statement.
        public let queryParameters: [SqlParameter]?
        /// The SQL statement.
        public let queryString: String?
        /// One or more SQL statements. Each query string in the array corresponds to one of the queries in a batch query request.
        public let queryStrings: [String]?
        /// The data format of the result of the SQL statement.
        public let resultFormat: ResultFormatString?
        /// The name or Amazon Resource Name (ARN) of the secret that enables access to the database.
        public let secretArn: String?
        /// The session identifier of the query.
        public let sessionId: String?
        /// The name of the SQL statement.
        public let statementName: String?
        /// The status of the SQL statement. An example is the that the SQL statement finished.
        public let status: StatusString?
        /// The date and time (UTC) that the statement metadata was last updated.
        public let updatedAt: Date?

        @inlinable
        public init(createdAt: Date? = nil, id: String, isBatchStatement: Bool? = nil, queryParameters: [SqlParameter]? = nil, queryString: String? = nil, queryStrings: [String]? = nil, resultFormat: ResultFormatString? = nil, secretArn: String? = nil, sessionId: String? = nil, statementName: String? = nil, status: StatusString? = nil, updatedAt: Date? = nil) {
            self.createdAt = createdAt
            self.id = id
            self.isBatchStatement = isBatchStatement
            self.queryParameters = queryParameters
            self.queryString = queryString
            self.queryStrings = queryStrings
            self.resultFormat = resultFormat
            self.secretArn = secretArn
            self.sessionId = sessionId
            self.statementName = statementName
            self.status = status
            self.updatedAt = updatedAt
        }

        private enum CodingKeys: String, CodingKey {
            case createdAt = "CreatedAt"
            case id = "Id"
            case isBatchStatement = "IsBatchStatement"
            case queryParameters = "QueryParameters"
            case queryString = "QueryString"
            case queryStrings = "QueryStrings"
            case resultFormat = "ResultFormat"
            case secretArn = "SecretArn"
            case sessionId = "SessionId"
            case statementName = "StatementName"
            case status = "Status"
            case updatedAt = "UpdatedAt"
        }
    }

    public struct SubStatementData: AWSDecodableShape {
        /// The date and time (UTC) the statement was created.
        public let createdAt: Date?
        /// The amount of time in nanoseconds that the statement ran.
        public let duration: Int64?
        /// The error message from the cluster if the SQL statement encountered an error while running.
        public let error: String?
        /// A value that indicates whether the statement has a result set. The result set can be empty. The value is true for an empty result set.
        public let hasResultSet: Bool?
        /// The identifier of the SQL statement. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API.  A suffix indicates the number of the SQL statement. For example, d9b6c0c9-0747-4bf4-b142-e8883122f766:2 has a suffix of :2 that indicates the second SQL statement of a batch query.
        public let id: String
        /// The SQL statement text.
        public let queryString: String?
        /// The SQL statement identifier. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API.
        public let redshiftQueryId: Int64?
        /// Either the number of rows returned from the SQL statement or the number of rows affected.  If result size is greater than zero, the result rows can be the number of rows affected by SQL statements such as INSERT, UPDATE, DELETE, COPY, and others. A -1 indicates the value is null.
        public let resultRows: Int64?
        /// The size in bytes of the returned results. A -1 indicates the value is null.
        public let resultSize: Int64?
        /// The status of the SQL statement. An example is the that the SQL statement finished.
        public let status: StatementStatusString?
        /// The date and time (UTC) that the statement metadata was last updated.
        public let updatedAt: Date?

        @inlinable
        public init(createdAt: Date? = nil, duration: Int64? = nil, error: String? = nil, hasResultSet: Bool? = nil, id: String, queryString: String? = nil, redshiftQueryId: Int64? = nil, resultRows: Int64? = nil, resultSize: Int64? = nil, status: StatementStatusString? = nil, updatedAt: Date? = nil) {
            self.createdAt = createdAt
            self.duration = duration
            self.error = error
            self.hasResultSet = hasResultSet
            self.id = id
            self.queryString = queryString
            self.redshiftQueryId = redshiftQueryId
            self.resultRows = resultRows
            self.resultSize = resultSize
            self.status = status
            self.updatedAt = updatedAt
        }

        private enum CodingKeys: String, CodingKey {
            case createdAt = "CreatedAt"
            case duration = "Duration"
            case error = "Error"
            case hasResultSet = "HasResultSet"
            case id = "Id"
            case queryString = "QueryString"
            case redshiftQueryId = "RedshiftQueryId"
            case resultRows = "ResultRows"
            case resultSize = "ResultSize"
            case status = "Status"
            case updatedAt = "UpdatedAt"
        }
    }

    public struct TableMember: AWSDecodableShape {
        /// The name of the table.
        public let name: String?
        /// The schema containing the table.
        public let schema: String?
        /// The type of the table. Possible values include TABLE, VIEW, SYSTEM TABLE, GLOBAL TEMPORARY, LOCAL TEMPORARY, ALIAS, and SYNONYM.
        public let type: String?

        @inlinable
        public init(name: String? = nil, schema: String? = nil, type: String? = nil) {
            self.name = name
            self.schema = schema
            self.type = type
        }

        private enum CodingKeys: String, CodingKey {
            case name = "name"
            case schema = "schema"
            case type = "type"
        }
    }

    public struct QueryRecords: AWSDecodableShape {
        /// The results of the SQL statement in CSV format.
        public let csvRecords: String?

        @inlinable
        public init(csvRecords: String? = nil) {
            self.csvRecords = csvRecords
        }

        private enum CodingKeys: String, CodingKey {
            case csvRecords = "CSVRecords"
        }
    }
}

// MARK: - Errors

/// Error enum for RedshiftData
public struct RedshiftDataErrorType: AWSErrorType {
    enum Code: String {
        case activeSessionsExceededException = "ActiveSessionsExceededException"
        case activeStatementsExceededException = "ActiveStatementsExceededException"
        case batchExecuteStatementException = "BatchExecuteStatementException"
        case databaseConnectionException = "DatabaseConnectionException"
        case executeStatementException = "ExecuteStatementException"
        case internalServerException = "InternalServerException"
        case queryTimeoutException = "QueryTimeoutException"
        case resourceNotFoundException = "ResourceNotFoundException"
        case validationException = "ValidationException"
    }

    private let error: Code
    public let context: AWSErrorContext?

    /// initialize RedshiftData
    public init?(errorCode: String, context: AWSErrorContext) {
        guard let error = Code(rawValue: errorCode) else { return nil }
        self.error = error
        self.context = context
    }

    internal init(_ error: Code) {
        self.error = error
        self.context = nil
    }

    /// return error code string
    public var errorCode: String { self.error.rawValue }

    /// The Amazon Redshift Data API operation failed because the maximum number of active sessions exceeded.
    public static var activeSessionsExceededException: Self { .init(.activeSessionsExceededException) }
    /// The number of active statements exceeds the limit.
    public static var activeStatementsExceededException: Self { .init(.activeStatementsExceededException) }
    /// An SQL statement encountered an environmental error while running.
    public static var batchExecuteStatementException: Self { .init(.batchExecuteStatementException) }
    /// Connection to a database failed.
    public static var databaseConnectionException: Self { .init(.databaseConnectionException) }
    /// The SQL statement encountered an environmental error while running.
    public static var executeStatementException: Self { .init(.executeStatementException) }
    /// The Amazon Redshift Data API operation failed due to invalid input.
    public static var internalServerException: Self { .init(.internalServerException) }
    /// The Amazon Redshift Data API operation failed due to timeout.
    public static var queryTimeoutException: Self { .init(.queryTimeoutException) }
    /// The Amazon Redshift Data API operation failed due to a missing resource.
    public static var resourceNotFoundException: Self { .init(.resourceNotFoundException) }
    /// The Amazon Redshift Data API operation failed due to invalid input.
    public static var validationException: Self { .init(.validationException) }
}

extension RedshiftDataErrorType: AWSServiceErrorType {
    public static let errorCodeMap: [String: AWSErrorShape.Type] = [
        "BatchExecuteStatementException": RedshiftData.BatchExecuteStatementException.self,
        "ExecuteStatementException": RedshiftData.ExecuteStatementException.self,
        "ResourceNotFoundException": RedshiftData.ResourceNotFoundException.self
    ]
}

extension RedshiftDataErrorType: Equatable {
    public static func == (lhs: RedshiftDataErrorType, rhs: RedshiftDataErrorType) -> Bool {
        lhs.error == rhs.error
    }
}

extension RedshiftDataErrorType: CustomStringConvertible {
    public var description: String {
        return "\(self.error.rawValue): \(self.message ?? "")"
    }
}
